passing data to php in ajax [closed]
Posted
by
MertMETIN
on Pro Webmasters
See other posts from Pro Webmasters
or by MertMETIN
Published on 2012-03-24T21:21:48Z
Indexed on
2012/03/24
23:39 UTC
Read the original article
Hit count: 397
i try to pass my data, actually checkboxes has some datas in their ids, and i read try to read them.
like that,
<input align="right" type=checkbox name="checkArtist[]" class="checkClass" id ="{$movieId}-{$mCast.id}"></li>
dont worry about
{$movieId}-{$mCast.id}
They are template lite tags.
I successfully read checkboxes datas in ajax side. The problem is that i cannot send these datas to my php.
var artistIds = new Array();
$(".p16 input:checked").each()(function(){
artistIds.push($(this).attr('id'));
});
$.post('/json/crewonly/deleteDataAjax2', { 'artistIds': artistIds },function(response){
if(response=='ok')
alert("ok");
});
above code is my ajax but in php side $artistIds is always empty.
I found a topic in stackoverflow http://stackoverflow.com/questions/5571646/how-to-pass-a-javascript-array-via-jquery-post-so-that-all-its-contents-are-acce
It says how to pass js arrays
$.post('/url/to/page', {'someKeyName': variableName});
This is same with my code.
What's going wrong ?
© Pro Webmasters or respective owner